package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.github.pagehelper.PageInfo;
import com.rm.zeyou.entity.Technician;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.BrokerService;
import com.rm.zeyou.util.login.TechnicianLoginUtil;
import com.rm.zeyou.vo.request.BrokerInvitationListVo;
import com.rm.zeyou.vo.response.BrokerIndexResponseVo;
import com.rm.zeyou.vo.response.BrokerInvitationListResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 经纪人表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:07
 */
@Api(tags = "经纪人相关")
@RestController
@RequestMapping("/api/broker")
public class BrokerController {
    @Resource
    private BrokerService brokerService;
    @Resource
    private TechnicianLoginUtil technicianLoginUtil;

    @ApiOperation(value = "经纪人页面")
    @PostMapping("brokerIndex")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<BrokerIndexResponseVo> brokerIndex() {
        Technician technician = technicianLoginUtil.getTechnician();
        return brokerService.brokerIndex(technician);
    }

    @ApiOperation(value = "经纪人邀请列表")
    @PostMapping("brokerInvitationList")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<PageInfo<BrokerInvitationListResponseVo>> brokerInvitationList(@RequestBody BrokerInvitationListVo requestVo) {
        Technician technician = technicianLoginUtil.getTechnician();
        return brokerService.brokerInvitationList(technician,requestVo);
    }

}
